﻿using System;

using enyo;

namespace com.RexToy
{
    public class VolmView : ConverterView
    {
        private object[] components = new object[]{ 
            new {kind= ControlKind.BasicScroller, 
                components=new object[] {
                    new {kind=ControlKind.RowGroup, 
                        components= new object[]{
				            new {name= "m3", richContent= false, kind = ControlKind.Input, onblur="blur",
                                    components=new object[]{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Cubic Meter")}
                                    }
                            },
                            new {name= "l", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components= new object[]{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Liter")}
				                    }
                            },
				            new {name= "oz", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Ounce")}
				                   }
				            },
                            new {name= "fgal", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("(Fl)Gallon")}
				                   }
				            },
                            new {name= "fqt", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("(Fl)Quart")}
				                   }
				            },
                            new {name= "fpt", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("(Fl)Pint")}
				                   }
				            },
                            new {name= "dqt", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("(Dry)Quart")}
				                   }
				            },
                            new {name= "dpt", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("(Dry)Pint")}
				                   }
				            }
			            }                    
		            }      
                }
            }
        };

        public override void Create()
        {
            this.Inherited(Arguments.Value);

            this.units = new string[] { "m3", "l", "oz", "fgal", "fqt", "fpt", "dqt", "dpt" };
            this.baseUnit = "m3";

            this.fomular = new object();

            this.fomular["m3->m3"] = "m3";
            this.fomular["m3->l"] = "m3*1000";
            this.fomular["l->m3"] = "l/1000";
            this.fomular["m3->oz"] = "m3*33814.0227";
            this.fomular["oz->m3"] = "oz/33814.0227";
            this.fomular["m3->fgal"] = "m3*264.1720524";
            this.fomular["fgal->m3"] = "fgal/264.1720524";
            this.fomular["m3->fqt"] = "m3*1056.6882094";
            this.fomular["fqt->m3"] = "fqt/1056.6882094";
            this.fomular["m3->fpt"] = "m3*2113.3764189";
            this.fomular["fpt->m3"] = "fpt/2113.3764189";
            this.fomular["m3->dqt"] = "m3*908.0829843";
            this.fomular["dqt->m3"] = "fqt/908.0829843";
            this.fomular["m3->dpt"] = "m3*1816.1659685";
            this.fomular["dpt->m3"] = "fpt/1816.1659685";
        }
    }
}
